package 设计模式.单例模式;

/**
 * @author : K k
 * @date : 9:49 2020/8/26
 */
public class Singleton_lazy {
    private static volatile  Singleton_lazy singleton=null;

    public Singleton_lazy() {
    }

    public Singleton_lazy getInstance(){
        //双重校验
        if (singleton!=null){
            synchronized (Singleton_lazy.class){
                if (singleton!=null){
                    singleton=new Singleton_lazy();
                }
            }
        }
        return singleton;
    }
}
